package services

/*
厦门大学计算机专业 | 前华为工程师
专注《零基础学编程系列》  http://lblbc.cn/blog
包含：Java | 安卓 | 前端 | Flutter | iOS | 小程序 | 鸿蒙
公众号：蓝不蓝编程
*/
import (
	"lblbc.cn/demo/dao"
	"lblbc.cn/demo/dto"
)

type OrderService interface {
	CreateOrder(userId int64, simpleCartItemList []dto.SimpleCartItem) dto.CreateOrderResp
	QueryOrder(orderId string) dto.QueryOrderResp
	QueryByStatus(userId int64, status string) []dto.QueryOrderResp
	DeleteOrder(orderId string) string
}

type orderService struct {
	orderDao dao.OrderDao
}

func NewOrderService(dao dao.OrderDao) OrderService {
	return &orderService{orderDao: dao}
}

func (s *orderService) CreateOrder(userId int64, simpleCartItemList []dto.SimpleCartItem) dto.CreateOrderResp {
	return s.orderDao.CreateOrder(userId, simpleCartItemList)
}

func (s *orderService) QueryOrder(orderId string) dto.QueryOrderResp {
	return s.orderDao.QueryOrder(orderId)
}

func (s *orderService) QueryByStatus(userId int64, status string) []dto.QueryOrderResp {
	return s.orderDao.QueryByStatus(userId, status)
}

func (s *orderService) DeleteOrder(orderId string) string {
	return s.orderDao.DeleteOrder(orderId)
}
